package framework;

import interfaces.Board;

import java.util.Stack;


/**
 * The Tracker class is used to record past Boards and visual states of
 * respective Boards in order to rewind.
 * Note: with each 'tick', stack will be pushed with new Board
 * @author bcharna
 *
 */
public class Tracker {
	
	Stack<Board> stack = new Stack<Board>();
	
	/**
	 * push a Board onto stack A
	 * @param b Board object
	 */
	void pushBoard(Board b)
	{
		stack.push(b);
	}
	
	/**
	 * pop the last Board from stack A
	 * @return last Board object or null if empty
	 */
	Board popBoard()
	{
		if (stack.isEmpty())
			return null;
		return stack.pop();
	}
	
}
